package com.health.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.health.entity.Disease;
import com.health.entity.pojo.PageData;
import com.health.entity.pojo.dto.QueryDiseaseDTO;
import com.health.entity.pojo.vo.DiseaseVO;
import com.health.mapper.DiseaseMapper;
import com.health.service.IDiseaseService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author fengjiaxing
 * @since 2023-04-15
 */
@Service
public class DiseaseServiceImpl extends ServiceImpl<DiseaseMapper, Disease> implements IDiseaseService {

    @Autowired
    private DiseaseMapper diseaseMapper;




    //疾病分页数据查询方法
    @Override
    public PageData getDiseaseByPage(Integer pageNum, Integer pageSize, QueryDiseaseDTO queryDiseaseDTO) {

        //创建分页对象
        IPage<Disease> page = new Page<>(pageNum,pageSize);
        //查询
        IPage ipage =  diseaseMapper.selectDisease(page,queryDiseaseDTO);
        //封装返回
        return new PageData(ipage.getTotal(),ipage.getRecords());
    }


    //多选疾病删除
    @Override
    public boolean deleteSelectDisease(List<Integer> ids) {
      return diseaseMapper.deleteSelectDisease(ids);
    }

}
